Index: libmpc/configure.in
===================================================================
--- a/configure.in
+++ b/configure.in
@@ -28,6 +28,12 @@ esac
 AC_SUBST([EXTRALIBS])
 
 AC_ARG_ENABLE([mpcchap], [AS_HELP_STRING([--enable-mpcchap], [enable building mpcchap])])
+if test "x$enable_mpcchap" = xyes; then
+  PKG_CHECK_MODULES(LIBCUE, libcue)
+  AC_SUBST(LIBCUE_CFLAGS)
+  AC_SUBST(LIBCUE_LIBS)
+fi
+
 AM_CONDITIONAL([MPC_CHAP], [test "x$enable_mpcchap" = xyes])
 
 
Index: libmpc/mpcchap/Makefile.am
===================================================================
--- a/mpcchap/Makefile.am
+++ b/mpcchap/Makefile.am
@@ -4,7 +4,8 @@ bin_PROGRAMS = mpcchap
 
 common_sources = ../common/tags.c ../common/crc32.c
 
-AM_CPPFLAGS = -I$(top_srcdir)/include
+AM_CPPFLAGS = -I$(top_srcdir)/include \
+	$(LIBCUE_CFLAGS)
 
 if HAVE_VISIBILITY
   AM_CFLAGS = -fvisibility=hidden
@@ -16,4 +17,4 @@ dictionary.h iniparser.h
 
 mpcchap_LDADD = $(top_builddir)/libmpcdec/libmpcdec.la \
 	$(top_builddir)/libmpcenc/libmpcenc.a \
-	-lm -lcuefile
+	-lm $(LIBCUE_LIBS)
Index: libmpc/mpcchap/mpcchap.c
===================================================================
--- a/mpcchap/mpcchap.c
+++ b/mpcchap/mpcchap.c
@@ -24,7 +24,7 @@
 
 #include <sys/stat.h>
 
-#include <cuetools/cuefile.h>
+#include <libcue/libcue.h>
 
 // tags.c
 void    Init_Tags        ( void );
@@ -153,13 +153,13 @@ mpc_status add_chaps_ini(char * mpc_file
 mpc_status add_chaps_cue(char * mpc_file, char * chap_file, mpc_demux * demux, mpc_streaminfo * si)
 {
 	Cd *cd = 0;
-	int nchap, format = UNKNOWN;
+	int nchap;
 	struct stat stbuf;
 	FILE * in_file;
 	int chap_pos, end_pos, chap_size, i;
 	char * tmp_buff;
 
-	if (0 == (cd = cf_parse(chap_file, &format))) {
+	if (0 == (cd = cue_parse_file(chap_file))) {
 		fprintf(stderr, "%s: input file error\n", chap_file);
 		return !MPC_STATUS_OK;
 	}
